package org.dy.servlet.mvc.ext;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.io.IOUtils;
import org.dy.db.support.BaseDAO;
import org.dy.servlet.mvc.Action;
import org.dy.servlet.mvc.ModelAndView;

public class DYAction implements Action {

	public ModelAndView process(HttpServletRequest req,
			HttpServletResponse resp) {
		// TODO Auto-generated method stub
		String ss=req.getParameter("ss");
		
		BaseDAO dao=new BaseDAO();
		dao.update(ss);
		
		String d=new Date().toLocaleString();
		try {
			OutputStream os=new FileOutputStream(
					req.getRealPath("properties/sy"));
			IOUtils.write(d, os);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		ModelAndView mv=new ModelAndView();
		mv.setMsg(d);
		return mv;
	}

}
